fix: prevent context mixing in Roo/Sonic model (fixes #7292) #7293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses Issue #7292 where the Roo/Sonic model was experiencing context mixing, causing it to give completely unrelated responses (e.g., implementing a pomodoro timer when asked for dark mode).
Problem
Users reported that the Roo/Sonic model would occasionally provide responses that were completely unrelated to their requests, as if it was responding to someone else's prompt. This suggests that context was being shared or mixed between different user sessions.
Solution
The fix implements multiple layers of isolation to prevent context mixing:
supportsPromptCache: falsefor the roo/sonic model to prevent any server-side caching that could cause context leakageTesting
Review Confidence
The implementation was reviewed with a confidence score of 92% (HIGH). All requirements are met and the code follows existing patterns and conventions.
Fixes #7292
Important
Fixes context mixing in Roo/Sonic model by disabling prompt caching and implementing session/request isolation in
RooHandler.supportsPromptCache: falseinroo.tsto prevent context mixing.RooHandlerby generating a unique session ID for each instance.X-Session-Id,X-Request-Id,X-No-Cache,Cache-Control,Pragma) to prevent caching.roo.spec.tsto verify session and request isolation.This description was created by
for 93fb461. You can customize this summary. It will automatically update as commits are pushed.